import request from '../utils/request'

export function getArticleList(params) {
  return request({
    url: '/article/page',
    method: 'post',
    data: {
      title: params.query || '',
      category: params.type || '',
      pageNum: params.pageNum || 1,
      pageSize: params.pageSize || 10
    }
  })
}

export function deleteArticle(id) {
  return request({
    url: `/article/${id}`,
    method: 'delete'
  })
}

export function insertArticle(article) {
  return request({
    url: '/article/insert',
    method: 'post',
    data: article
  })
}

// 添加获取文章详情的方法
export const getArticleDetail = (id) => {
  return request({
    url: `/article/${id}`,
    method: 'get'
  })
}

// 获取文章段落及拼音信息
export const getArticlePronunciation = (id) => {
  return request({
    url: `/article/${id}/content`,
    method: 'get'
  })
}